// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import VueRouter from 'vue-router'
import axios from 'axios'
/**
 * 增加图表
 */
import echarts from 'echarts'
import {
  Row,
  Col,
  Lazyload,
  Tab,
  Tabs,
  Swipe,
  SwipeItem,
  Sku,
  Cell,
  CellGroup,
  CouponCell,
  CouponList,
  Popup,
  GoodsAction,
  GoodsActionBigBtn,
  GoodsActionMiniBtn,
  AddressList,
  Toast,
  AddressEdit,
  Tag,
  Checkbox,
  CheckboxGroup,
  Stepper,
  SubmitBar,
  Icon,
  RadioGroup,
  Radio,
  Dialog,
  Uploader,
  PullRefresh,
} from 'vant';
import globe from './components/globe'
import VueResource from 'vue-resource'
import VueWechatTitle from 'vue-wechat-title'
import moment from 'moment/moment'
import VueClipboard from 'vue-clipboard2'
import store from './store/store'
Vue.use(RadioGroup);
Vue.use(Radio);
Vue.use(Uploader);
Vue.use(Icon);
Vue.filter('moment', function (value, formatString) {
  formatString = formatString || 'YYYY-MM-DD HH:mm:ss';
  return moment(value).format(formatString);

});
Vue.use(PullRefresh);
Vue.use(VueWechatTitle);
Vue.use(Tab).use(Tabs).use(Swipe).use(SwipeItem).use(Lazyload);
/*axios.defaults.baseURL = "http://apidoc.napin.com/server/";*/
Vue.prototype.$axios = axios;
window.axios = axios;
Vue.use(VueRouter);
Vue.config.productionTip = false;
Vue.use(Row).use(Col);
Vue.use(Sku);
Vue.use(Cell).use(CellGroup);
Vue.use(CouponCell).use(CouponList);
Vue.use (Popup);
Vue.use(VueClipboard)
Vue
  .use(GoodsAction)
  .use(GoodsActionBigBtn)
  .use(GoodsActionMiniBtn);
Vue.use(AddressList);
Vue.use(Toast);
Vue.use(AddressEdit);
Vue.use(Tag);
Vue.use(VueResource);
Vue.use(Checkbox).use(CheckboxGroup).use(Stepper);
Vue.use(SubmitBar);


Vue.use(Dialog);
Vue.prototype._globe =globe;
import "./assets/common.scss";
import "../src/assets/iconfont/iconfont.css";

new Vue({
  el: '#napin',
  router,
  store,
  components: { App },
  template: '<App/>'
});
router.beforeEach((to, from, next) => {
  /* 路由发生变化修改页面title */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
  window.scrollTo(0,0);
})
